package com.xxx.listener;

import java.util.Properties;

import javax.servlet.ServletContextEvent;

import org.springframework.web.context.ContextLoaderListener;

import com.xxx.util.JodaUtil;

/**
 * 重写springmvc的ContextLoaderListener
 * web.xml里就不能再配置ContextLoaderListener了
 */
public class SystemListener extends ContextLoaderListener {
	
    public static String osName;
    public static String realPath;
    public static String buildNo;  // 系统启动时间戳，作为静态资源版本号
 
    @Override
    public void contextInitialized(ServletContextEvent event) {
        super.contextInitialized(event);
        
        Properties props = System.getProperties();
        osName = props.getProperty("os.name");
        
        realPath = event.getServletContext().getRealPath("/");
        
        buildNo = JodaUtil.getBuildNo();
    }

    @Override
    public void contextDestroyed(ServletContextEvent event) {
        super.contextDestroyed(event);
    }

}
